<template>
  <el-container style="height: 100%">
    <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
      <el-menu
        style="height: 100%"
        router
        unique-opened
        background-color="#2b4351"
        text-color="#fff"
        active-text-color="#00A4FF"
        :default-active="$route.path"
      >
        <div v-for="(item, index) in menuList" :key="index">
          <el-submenu v-if="item.children && !item.hidden" :index="item.path">
            <template slot="title">
              <span>{{ item.meta.title }}</span>
            </template>
            <el-menu-item
              v-for="menu in item.children"
              :key="menu.path"
              :index="item.path + '/' + menu.path"
              >{{ menu.meta.title }}</el-menu-item
            >
          </el-submenu>
          <el-menu-item v-else :index="item.path">
            <span slot="title">{{ item.meta.title }}</span>
          </el-menu-item>
        </div>
      </el-menu>
    </el-aside>

    <el-container>
      <el-header style="text-align: right; font-size: 12px">
        <el-dropdown>
          <i class="el-icon-setting" style="margin-right: 15px"></i>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item>查看</el-dropdown-item>
            <el-dropdown-item>新增</el-dropdown-item>
            <el-dropdown-item>删除</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
        <span>王小虎</span>
      </el-header>
      <el-main>
        <el-card style="width: 100%; height: 70px"> <Tabs /></el-card>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import Tabs from "@/components/tabs.vue";
export default {
  components: {
    Tabs,
  },
  data() {
    const item = {
      date: "2016-05-02",
      name: "王小虎",
      address: "上海市普陀区金沙江路 1518 弄",
    };
    return {
      tableData: Array(20).fill(item),
      menuList: [],
    };
  },
  mounted() {
    this.menuList = JSON.parse(sessionStorage.getItem("sell_menus"));
    console.log(this.menuList);
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.el-header {
  background-color: #b3c0d1;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
</style>
